/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package escr.persistencia;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Aditardo
 */
@Entity
@Table(name = "tipo_programa")
@NamedQueries({@NamedQuery(name = "TipoPrograma.findByPrgCod", query = "SELECT t FROM TipoPrograma t WHERE t.prgCod = :prgCod"), @NamedQuery(name = "TipoPrograma.findByPrgNombre", query = "SELECT t FROM TipoPrograma t WHERE t.prgNombre = :prgNombre")})
public class TipoPrograma implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Column(name = "PRG_COD", nullable = false)
    private Integer prgCod;
    @Column(name = "PRG_NOMBRE")
    private String prgNombre;
    @JoinColumn(name = "EMP_CODIGO", referencedColumnName = "EMP_CODIGO")
    @ManyToOne
    private Empleado empCodigo;
    @OneToMany(mappedBy = "prgCod")
    private Collection<Documento> documentoCollection;

    public TipoPrograma() {
    }

    public TipoPrograma(Integer prgCod) {
        this.prgCod = prgCod;
    }

    public Integer getPrgCod() {
        return prgCod;
    }

    public void setPrgCod(Integer prgCod) {
        this.prgCod = prgCod;
    }

    public String getPrgNombre() {
        return prgNombre;
    }

    public void setPrgNombre(String prgNombre) {
        this.prgNombre = prgNombre;
    }

    public Empleado getEmpCodigo() {
        return empCodigo;
    }

    public void setEmpCodigo(Empleado empCodigo) {
        this.empCodigo = empCodigo;
    }

    public Collection<Documento> getDocumentoCollection() {
        return documentoCollection;
    }

    public void setDocumentoCollection(Collection<Documento> documentoCollection) {
        this.documentoCollection = documentoCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (prgCod != null ? prgCod.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TipoPrograma)) {
            return false;
        }
        TipoPrograma other = (TipoPrograma) object;
        if ((this.prgCod == null && other.prgCod != null) || (this.prgCod != null && !this.prgCod.equals(other.prgCod))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "escr.persistencia.TipoPrograma[prgCod=" + prgCod + "]";
    }

}
